import Vue from 'vue'
import VueRouter from 'vue-router'
//import bookTable from "@/components/bookmgt/bookTable";
import bookEnter from "@/components/bookborrow/bookEnter";
// import Login from '../components/Login'
// import Home from "../components/Home"
// import Welcome from "../components/Welcome"
// import UserList from "../components/user/userList"
// import PowList from "../components/power/PowList"
// import RoleList from "../components/power/RoleList"
// import SystemSql from "../components/system/SystemSql";
// import OrderList from "../components/order/OrderList";
// import OutputList from "../components/output/OutputList";
// import Enter from "../components/warehouse/Enter";
// import Out from "../components/warehouse/Out";
// import Check from "../components/warehouse/Check";
// import Ship from "../components/data/Report";
// import ClientList from "../components/client/ClientList";
// import MyWarehouse from "../components/warehouse/MyWarehouse";
// import Region from "../components/warehouse/Region";
// import Shelf from "../components/warehouse/Shelf";
// import Transition from "../components/output/Transition";
// import Report from "../components/data/Report";
// import AddressBook from "../components/comm/AddressBook";
//懒加载
const Login =() => import('../components/Login')
const Home =() => import('../components/Home')
const Welcome =() => import('../components/Welcome')
const UserList =() => import('../components/user/userList')
const PowList =() => import('../components/power/PowList')
const RoleList =() => import('../components/power/RoleList')
const SystemSql =() => import('../components/system/SystemSql')
const OrderList =() => import('../components/order/OrderList')
const OutputList =() => import('../components/output/OutputList')
const Enter =() => import('../components/warehouse/Enter')
const Out =() => import('../components/warehouse/Out')
const Check =() => import('../components/warehouse/Check')
const Ship =() => import('../components/data/Report')
const ClientList =() => import('../components/client/ClientList')
const MyWarehouse =() => import('../components/warehouse/MyWarehouse')
const Region =() => import('../components/warehouse/Region')
const Shelf =() => import('../components/warehouse/Shelf')
const Transition =() => import('../components/output/Transition')
const Report =() => import('../components/data/Report')
const AddressBook =() => import('../components/comm/AddressBook')
const bookInfo =() => import('../components/bokcontent/BookInfo')
const borrowInfo =() => import('../components/bookborrow/borrowInfo')
const articleManagemrnt=()=>import('../components/bokcontent/ArticleManagement')
const entermanager =()=>import('../components/user/entermanager')
const bookOut = ()=>import('../components/bookborrow/bookOut')
const bookTable = ()=>import('../components/bookmgt/bookTable')
Vue.use(VueRouter)

const routes = [
    {path: '/', redirect: '/home'},
    {path: '/login', component: Login},
    {
        path: '/home',
        component: Home,
        redirect: '/welcome',
        children: [
            {
                path: '/welcome',
                component: Welcome
            },
            {
                path: '/userList',
                component: UserList
            },
            {
                path: '/powList',
                component: PowList
            },
            {
                path: '/roleList',
                component: RoleList
            },
            {
                path: '/systemSql',
                component: SystemSql
            },
            {
                path: '/orderList',
                component: OrderList
            },
            {
                path:'/outputList',
                component:OutputList
            },
            {
                path:'/myWarehouse',
                component:MyWarehouse
            },
            {
                path:'/enter',
                component:Enter
            },
            {
                path:'/out',
                component:Out
            },
            {
                path:'/check',
                component:Check
            },
            {
                path:'/ship',
                component:Ship
            },
            {
                path:'/clientList',
                component:ClientList
            },
            {
                path:'/region',
                component:Region
            },
            {
                path:'/shelf',
                component:Shelf
            },
            {
                path:'/transition',
                component:Transition
            },
            {
                path:'/report',
                component:Report
            },
            {
                path:'/addressBook',
                component:AddressBook
            },
            {
                path:'/bookInfo',
                component:bookInfo
            },
            {
                path:'/borrowInfo',
                component:borrowInfo
            },
            {
                path: '/articleManagemrnt',
                component:articleManagemrnt
            },
            {
                path: '/entermanager',
                component:entermanager
            },
            {
                path: '/bookOut',
                component:bookOut
            },
            {
                path: '/bookTable',
                component:bookTable
            }
        ]
    }
]

const router = new VueRouter({
    routes
})
// //挂载路由导航守卫
// router.beforeEach((to, from, next) => {
//     //to将要访问的路径
//     //from代表从哪个路径跳转过来
//     //next是一个函数表示放行
//     //next()放行  next('/login') 跳转到登登录页
//     if (to.path == '/login') return next();
//     //获取用户数据
//     const user = window.sessionStorage.getItem('user')
//     const cookie=document.cookie;
//     if (!cookie) return next('/login');
//     next()
//
// })
export default router
